<?php

namespace App\Http\Requests\Api;

use Illuminate\Foundation\Http\FormRequest;

class ShopRoleRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'role' => 'required|between:1,3',
            'shop_id' => 'required',
            'name' => 'required|between:1,20',
            'phone' => 'required|regex:/^1[34578][0-9]{9}$/',
            'address' => 'required',
            // 'self_introduction' => 'required',
            'img_url' => 'required',
            'label' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'phone.required' => '手机号必填', 
            'phone.regex' => '手机号格式错误', 
            'name.between' => '姓名长度必须为1-20位'
        ];
    }


}
